import matplotlib.pyplot as plt
import pandas as pd
plt.rcParams['font.sans-serif']= 'SimHei'
plt.rcParams['axes.unicode_minus'] = False
df = pd.read_excel('学生各学期成绩表.xlsx',index_col=0)
data = df.agg('mean',numeric_only=True)
plt.pie(data,labels=data.index,autopct='%.2f%%')
plt.title('各科成绩占比饼图')
plt.show()